/**
 *  loading效果
 * 
 * 
 * 
 */



export  let  showLoading=(data)=>{
    return  new  Promise((resolve,reject)=>{
        wx.showLoading({
            title:data.title ,
            mask: true,
            success: (result) => {
                console.log(result)
                resolve(result)
            },
            fail: (err) => {
                reject(err)
            },
            complete: () => {}
        });
          

    })

}




/**
 * showModal 弹框
 * 
 * 
 */



   

export  let  showModal=(params)=>{

    

return  new   Promise((resolve,reject)=>{

console.log('showModal')
    wx.showModal({
        title: params.title ||'默认值' ,
        content: params.content ||'默认值',
        showCancel: params.showCancel || true ,
        success: (result) => {
            if (result.confirm) {
                
                resolve(result)      
            }
        },
        fail: (err) => {
            reject(err)
        },
       
    });
      

})

}



/**
 * getSetting  获取用户设置
 * 
 */
export  let  getSetting=()=>{
    return  new Promise((resolve,reject)=>{

        wx.getSetting({
            success: (result) => {
                resolve(result)  
            },
            fail: (err) => {
                reject(err)
            },
            
        });

    })
   
      
}

/**
 * 
 * 
 * 获取用户收货地址
 */

  export  let  chooseAddress=()=>{

    return  new Promise((resolve,reject)=>{

       wx.chooseAddress({
           success: (result) => {
                 resolve(result)
           },
           fail: (err) => {
            reject(err)
           },
          
       });
         

    })
}



export  let  openSetting=()=>{

    return  new Promise((resolve,reject)=>{

    wx.openSetting({
        success: (result) => {
            resolve(result)
            
        },
        fail: (err) => {
            reject(err)
        },
       
    });
      
         

    })

}



